#include "poly/term.h"
#include "poly/polynom.h"
#include <cstring>
int interactive();
int demo();
int main(int argc, char *argv[])
{
    bool isInteractive = false;
    if ((argc == 2) && strcmp(argv[1], "i") == 0)
    {
        isInteractive = true;
    }
    if (isInteractive)
    {
        return interactive();
    }
    else
    {
        return demo();
    }
}
int demo()
{
    Term t1(5, 2), t2(16, 2), t3, t4, t5;
    std::cout << "t1 = " << t1 << std::endl;
    std::cout << "t2 = " << t2 << std::endl;
    t3 = t1 + t2;
    std::cout << "t1 + t2 = " << t3 << std::endl;
    Polynomial p1(t1), p2(t2), p3, p4;
    std::cout << "p1 = " << p1 << std::endl;
    std::cout << "p2 = " << p2 << std::endl;
    p3 = p1 + p2;
    std::cout << "p3 = p1 + p2" << '\t';
    std::cout << "p3 = " << p3 << std::endl;
    p4 = p1 * p2;
    std::cout << "p4 = p1 * p2" << '\t';
    std::cout << "p4 = " << p4 << std::endl;
    p3 *= p2;
    std::cout << "p3 * p2 = " << p3 << std::endl;
    p4 += p3;
    std::cout << "p4 + p3 = " << p4 << std::endl;
    return 0;
}
int interactive()
{
    Term t1, t2, t3, t4, t5;
    std::cin >> t1;
    std::cout << "t1 = " << t1 << std::endl;
    std::cin >> t2;
    std::cout << "t2 = " << t2 << std::endl;
    t3 = t1 + t2;
    std::cout << "t1 + t2 = " << t3 << std::endl;
    Polynomial p1, p2, p3, p4;
    std::cout << "p1 = " << p1;
    std::cin >> p2;
    std::cout << "p2 = " << p2;
    p3 = p1 + p2;
    std::cout << "p3 = p1 + p2" << std::endl;
    std::cout << "p3 = " << p3;
    p4 = p1 * p2;
    std::cout << "p4 = p1 * p2" << std::endl;
    std::cout << "p4 = " << p4;
    p3 *= p2;
    std::cout << "p3 * p2 = " << p3;
    p4 += p3;
    std::cout << "p4 + p3 = " << p4;
    return 0;
}